﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using Genuilder.Extensibility;
using Genuilder.Extensibility.Tests;
using Genuilder.Tests;

namespace Genuilder.Extensions.Tests
{
	public class TestClass
	{
		const string TestProject = "../../Data/TestProject";
		[Fact]
		public void CanCompileExtensions()
		{
			using(var directory = new TestDirectory().Of(TestProject))
			{
				IExtension[] extensions = new IExtension[] 
				{ 
					new AsyncServiceContractsExtension()
					{
					    Files = new string[]{ "Contract1.cs", "Contract2.cs" }
					},
					new ProxyGeneratorExtension()
					{
						Files = new string[] { "Interface1.cs" }
					},
					new StronglyTypedReflectionExtension()
					{
						Files = new string[] { "Class1.cs" }
					}
				};

				var project = Projects.InDirectory(directory.Path).First();
				foreach(var extension in extensions)
				{
					var extensibility = new ExtensibilityFeature();
					extensibility.AddExtensions(extensions);
					project.InstallFeature(extensibility);
					project.Save();
					project.Build().AssertBuild();
				}
			}
		}
	}
}
